<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends MY_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
//        $jump = false;
//         if(isset($_SERVER['HTTP_REFERER']))
//         {
//             if(!preg_match("/^http:\/\/.*?tom\.com/", $_SERVER['HTTP_REFERER']))
//             {
//                 $jump = true;
//             }
//         }

        //$class = config_item('class');
        //echo '<pre>';print_r($class['1']);exit;
        $this->load->model('movie');
        $field = 'id, china_name, starring, area, type, version, language, update_status, img_addr, public_time, update_time,create_time';

        $movie   = $this->movie->getMovieList($field, 18, 0, array('class' => 1), 'update_time desc');//'1' => '电影'
        $tv      = $this->movie->getMovieList($field, 14, 0, array('class' => 2), 'update_time desc');//'2' => '剧集'
        $vareity = $this->movie->getMovieList($field, 14, 0, array('class' => 3), 'update_time desc');//'3' => '综艺'
        $anima   = $this->movie->getMovieList($field, 10, 0, array('class' => 4), 'update_time desc');//'4' => '动漫'
        $music   = $this->movie->getMovieList($field, 10, 0, array('class' => 5), 'update_time desc');//'5' => '音乐'

        $rank['movie'] = $this->movie->rank(1, 15, 'id, china_name, version, language');
        $rank['tv'] = $this->movie->rank(2, 15, 'id, china_name, version, language');
        $rank['zy'] = $this->movie->rank(3, 10, 'id, china_name, version, language');
        $rank['dm'] = $this->movie->rank(4, 10, 'id, china_name, version, language');
        //print_r($rank);

        $vData = array(
            //'jump' => $jump,
            'movie' => $movie,
            'tv' => $tv,
            'vareity' => $vareity,
            'anima' => $anima,
            'music' => $music,
            'title' => '首页 电影1010 全网最全的影视、音乐、动漫资源、电驴资源',
            'rank' => $rank,
            'data' => array('id' => 0, 'class' => 99),
            "keywords" => '电影1010,电驴资源,电驴下载,emule下载,emule资源,电骡下载,电骡资源,迅雷下载,电影下载,ed2k资源分享,电视剧下载,最新电影,美剧,日剧,韩剧,3D电影,高清电影下载,迅雷看看,免费Gvod电影,kankan,百度影音',
            'description' => '全网最全的电影资源 电影1010最新无水印电影（绝不会影响观看效果）、最新电视剧、在线观看、迅雷电影下载、边下边看。',
        );

        $this->load->view('index', $vData);
        file_put_contents(FCPATH.'index.html', $this->formatHTML(), LOCK_EX);
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */